home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17989 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  47 lines

  1. Path: news.th-darmstadt.de!news
  2. From: Enno Sandner <enno@intellektik.informatik.th-darmstadt.de>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: A LINKed LIST Question
  5. Date: Thu, 18 Apr 1996 13:37:40 +0200
  6. Organization: Fachbereich Informatik, TH Darmstadt
  7. Message-ID: <31762984.59E2B600@intellektik.informatik.th-darmstadt.de>
  8. References: <4l4m21$sr1@falcon.ccs.uwo.ca>
  9. NNTP-Posting-Host: kitz.intellektik.informatik.th-darmstadt.de
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.01 (X11; I; SunOS 4.1.3 sun4m)
  14.  
  15. Sharon Wang wrote:
  16. > I have the following def'n
  17. > class Node {
  18. >     ItemType item1;  // ItemType define
  19. >     ItemType item2;
  20. >     ...
  21. > public:
  22. >     functions on item;
  23. > };
  24. > class NodeList {
  25. >     Node  N;
  26. >     Node* FLink;
  27. >     Node* BLink;
  28. > public:
  29. >     functions on Node;
  30. > };
  31. > However, I can't access the members of Node in the list since
  32. > they are "private".  How can I get arount this WIHTOUT using
  33. > access functions in class Node.
  34.  
  35. Declare 'NodeList' as friend of 'Node':
  36. class Node {
  37.    friend class NodeList;
  38.    ...
  39. };
  40.  
  41.     Enno
  42.